import $http from '@/assets/js/http'

//获得置换订单列表
export function getOrdersList(userId,index,size,lang) {
    return $http.get('/api/order/exchange/list', {
        params: { 
            userId:userId,
            pageIndex:index,
            pageSize:size,
            lang:lang,
        }
    });
}
//置换订单详情
export function getOrdersDetails(id,lang) {
    return $http.get('/api/order/exchange/detail', {
        params: { 
            orderId:id,
            lang:lang,
        }
    });
}

//置换订单申请关闭
export function postCloseOrder (param) {
    return $http.post('/api/order/exchange/applyClose',{
        orderId:param.orderId,
        reason:param.reason,//原因
        lang:param.lang,
    });
}

//置换订单确认交易
export function postSureOrder (param) {
    return $http.post('/api/order/exchange/check',{
        orderId:param.orderId,
        result:param.result,//确认结果：1不同意置换、2同意置换
        lang:param.lang,
    });
}

//置换订单确认发货
export function postSendExpress2 (param) {
    return $http.post('/api/order/exchange/express',{
        orderId:param.orderId,
        expressCompany:param.expressCompany,//快递公司
        expressKey:param.expressKey,//快递公司Key
        expressCode:param.expressCode,//快递单号
        lang:param.lang,
    });
}

//置换订单确认收货
export function postFinishExpress (param) {
    return $http.post('/api/order/exchange/finish',{
        orderId:param.orderId,
        lang:param.lang,
    });
}

//置换订单拒绝置换
export function postRefuse (param) {
    return $http.post('/api/order/exchange/check',{
        orderId:param.orderId,
        result:param.result,
        lang:param.lang,
    });
}
//置换订单删除
export function postDeleteOrder (param) {
    return $http.post('/api/order/exchange/delete',{
        orderId:param.orderId,
        lang:param.lang,
    });
}
